/*
 * DistResponseCodeEnum.java
 * Copyright 2021 Qunhe Tech, all rights reserved.
 * Qunhe PROPRIETARY/CONFIDENTIAL, any form of usage is subject to approval.
 */

package top.bbman.boot.repository.enums;

import top.bbman.boot.repository.base.PeaErrorCode;

import java.io.Serializable;

/**
 * 全局状态码
 *
 * @author 祥霸
 * @version 1.0.0
 */
public enum PeaCodeEnum implements Serializable, PeaErrorCode {

    /** 成功*/
    SUCCESS(200, "OK"),

    /** 未知异常*/
    ERROR(500, "系统开了会小差"),

    /** 请求参数有误*/
    PARAMS_BAD(400, "参数错误"),

    /** 未登录*/
    NO_LOGIN(401, "未登录"),

    /** 无操作权限*/
    NO_PERMISSION(403, "无操作权限"),

    ;

    private final int code;

    private final String msg;

    PeaCodeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public int code() {
        return code;
    }

    @Override
    public String msg() {
        return msg;
    }
}
